﻿function selectRating(num, elm) {
    $(elm).parent().parent().get(0).className = "re" + num + "";
    if (num == 1) {
        $('.retext', $(elm).parent().parent()).html("非常差");
    } else if (num == 2) {
        $('.retext', $(elm).parent().parent()).html("比较差");
    }
    else if (num == 3) {
        $('.retext', $(elm).parent().parent()).html("一般");
    }
    else if (num == 4) {
        $('.retext', $(elm).parent().parent()).html("比较好");
    } else if (num == 5) {
        $('.retext', $(elm).parent().parent()).html("很好");
    }
    $('input[name="Rating"]').val(num);
}

$(function () {
    //发表评价表单验证
    $("#publishCommentForm").validate({
        rules: {
            Title: {
                required: true,
                minlength: 2
            },
            Memo: {
                required: true,
                minlength: 6
            }
        },
        submitHandler: function (form) {
            form.submit();
        }
    });
});